﻿namespace GoodAdmin.Web.Core;

/// <summary>
/// 人员管理控制器
/// </summary>
[ApiDescriptionSettings("System", Tag = "个人中心")]
[Route("/system/userCenter")]
public class UserCenterController : IDynamicApiController
{
    private readonly ISysUserService _userService;
    private readonly IExtraOrgService _extraOrgService;

    public UserCenterController(ISysUserService userService, IExtraOrgService extraOrgService)
    {
        _userService = userService;
        _extraOrgService = extraOrgService;
    }

    /// <summary>
    /// 获取登录用户菜单列表
    /// </summary>
    /// <returns></returns>
    [HttpGet("loginUserMenu")]
    [DisplayName("获取登录用户菜单列表")]
    public Task<List<MenuOutPut>> GetLoginUserMenu()
    {
        return _userService.GetLoginUserMenu();
    }

    /// <summary>
    /// 获取登录用户信息
    /// </summary>
    /// <returns></returns>
    [HttpGet("loginUserDetail")]
    [DisplayName("获取登录用户信息")]
    public async Task<UserOutput> GetLoginUserDetail()
    {
        return await _userService.GetLoginUserDetail();
    }

    /// <summary>
    /// 获取组织列表树
    /// </summary>
    /// <returns></returns>
    [HttpGet("orgTree")]
    [DisplayName("获取组织列表树")]
    public async Task<List<SysOrg>> GetOrgTree()
    {
        return await _extraOrgService.GetOrgTree();
    }
}
